package com.team.controller;

import com.team.entity.Admin;
import com.team.entity.User;
import com.team.service.ReservationService;
import com.team.util.WebUtil;
import com.team.vo.ReservationVo;
import com.team.vo.Result;
import com.team.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import javax.rmi.CORBA.Util;

/**
 * @author : 陈灰灰
 * @Date: 2022/10/15/16:29
 * @Description:
 */
@RestController
@RequestMapping("/reservation")
public class ReservationController {
    @Autowired
    private ReservationService reservationService;

    /**
     * 预订单
     *
     * @param currentPage   当前页面
     * @param pageSize      页面大小
     * @param reservationVo 预约签证官
     * @return {@link Result}
     */
    @RequestMapping("/reservationList")
    public Result reservationList(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "5") int pageSize, @RequestBody ReservationVo reservationVo){
        Admin admin = (Admin) WebUtil.getSession().getAttribute("admin");
        return reservationService.queryAllReservationsByAccount(currentPage,pageSize,admin.getAccount(),reservationVo);
    }
    @RequestMapping("/deleteById")
    public Result deleteById(int id){
        return reservationService.deleteById(id);
    }

}
